import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      meta: {
        title: '登录'
      },
      component: () => import('../views/login/index.vue')
    },
    {
      path: '/',
      name: 'home',
      redirect: '/login',
      meta: {
        title: '首页'
      },
      component: () => import('../views/container/index.vue'),
      children: [
        {
          path: '/allview/:word?',
          component: () => import('../views/home/index.vue'),
          meta: { title: '所有' }
        },
        {
          path: 'imgview',
          component: () => import('../views/imageView/index.vue'),
          meta: { title: '图片' }
        },
        {
          path: 'textview',
          component: () => import('../views/text/index.vue'),
          meta: { title: '文档' }
        },
        {
          path: 'vedioview',
          component: () => import('../views/vedio/index.vue'),
          meta: { title: '视频' }
        },
        {
          path: 'music',
          component: () => import('../views/music/index.vue'),
          meta: { title: '音乐' }
        },
        {
          path: 'otherview',
          component: () => import('../views/other/index.vue'),
          meta: { title: '其他' }
        },
        {
          path: '/calendar',
          component: () => import('../views/calendar/index.vue'),
          meta: { title: '日历' }
        },
        {
          path: '/reqInfo',
          name: 'RequestInformation',
          component: () => import('../views/requestInfo/index.vue'),
          meta: { title: '文档' }
        },
        {
          path: '/recovery',
          component: () => import('../views/recovery/index.vue'),
          meta: { title: '回收站' }
        },
        {
          path: '/collFile',
          name: 'CollectFiles',
          component: () => import('../views/collectFiles/index.vue'),
          meta: { title: '收集文件' }
        },
        {
          path: '/collHW',
          name: 'CollectHomework',
          component: () => import('../views/collectHomework/index.vue'),
          meta: { title: '文件收集' }
        },
        {
          path: '/SettingPerson',
          name: 'SettingPerson',
          component: () => import('../views/settingPerson/index.vue'),
          meta: { title: '个人中心' }
        },
        {
          path: '/SharedFiles',
          name: 'SharedFiles',
          component: () => import('../views/SharedFiles/index.vue'),
          meta: { title: '已分享文件' }
        },
        {
          path: '/design',
          name: 'design',
          component: () => import('../views/design/index.vue')
        },
        {
          path: '/render/:id?',
          name: 'render',
          component: () => import('../views/render/index.vue')
        },
        {
          path: '/test',
          name: 'test',
          component: () => import('../views/tool/Test.vue')
        },
        {
          path: '/collectTask',
          name: 'collectTask',
          component: () => import('../views/collectTask/index.vue')
        }
      ]
    },
    {
      //错误跳转页面
      path: '/:word?/:w?',
      name: '404',
      component: () => import('../views/error/index.vue')
    },
    {
      path: '/sharePublicFile/:id?',
      name: 'sharePublicFile',
      meta: {
        title: '分享文件提取验证'
      },
      component: () => import('../views/getShareFile/index.vue')
    },
    {
      path: '/publicPage',
      name: 'publicPage',
      meta: {
        title: '分享公共文件'
      },
      component: () => import('../views/publicPage/index.vue')
    }
  ]
})

export default router
